<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>员工列表</title>

<script type="text/javascript" src="static/js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="static/bootstrap-3.3.7-dist/css/bootstrap.css">
<script type="text/javascript" src="static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

</head>
<body>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<h1>SSM-CRUD</h1>
			</div>
		</div>
		<div class="row">
			<div class="col-md-4 col-md-offset-8">
				<button class="btn btn-primary btn-sm">新增</button>
				<button class="btn btn-danger btn-sm">删除</button>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<table class="table table-hover">
					<tr>
						<th>#</th>
						<th>empName</th>
						<th>gender</th>
						<th>email</th>
						<th>depiName</th>
						<th>操作</th>
					</tr>
				#foreach($e in $pageInfo.list)
					<tr>
						<td>$!e.empId</td>
						<td>$!e.empName</td>
						#if($!e.gender == "M")
						<td> 男 </td>
						#else
						<td> 女</td>
						#end
						<td>$!e.email</td>
						<td>$!e.department.deptName</td>
						<td>
							<button class="btn btn-primary btn-sm">编辑</button>
							<button class="btn btn-danger btn-sm">删除</button>
						</td>
					</tr>
				#end	
					
				</table>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6">
				当前 ${pageInfo.pageNum}页,总${pageInfo.pages}页,共${pageInfo.total}条记录
			</div>
			<div class="col-md-6">
				<nav aria-label="Page navigation">
					  <ul class="pagination">
					  		#if($pageInfo.pageNum == "1")
					  		<li class="disabled"><a href="javascript:void(0)">首页</a></li>
					  		#else					  	
					  		<li ><a href="emps?pn=1">首页</a></li>
							#end
					  		
					  		
						  	<li>
						  	#if($pageInfo.hasPreviousPage)
						  	 #set($a=$pageInfo.pageNum)
					   		 #set($b=$a - 1)
						      <a href="emps?pn=$b" aria-label="Previous">
						        <span aria-hidden="true">&laquo;</span>
						      </a>
						     #end
						    </li>
					  						  						   
					  
					    	#foreach($nav in $pageInfo.navigatepageNums)
					    	#if($nav == $pageInfo.pageNum)
					    	<li class="active"><a href="#">$nav</a></li>
					    	#else
					    	<li ><a href="emps?pn=$nav">$nav</a></li>
					    	#end			    
					    	#end
					   		
					   		#if($pageInfo.hasNextPage)
					   		 #set($a=$pageInfo.pageNum)
					   		 #set($b=$a + 1)
					    	 <li>
							      <a href="emps?pn=$b" aria-label="Next">
							        <span aria-hidden="true">&raquo;</span>
							      </a>
					    	</li>
					   		#end
					   
					   		#if($pageInfo.isLastPage == true)
					   		 <li class="disabled"><a href="javascript:void(0)">末页</a></li>
					   		#elseif($pageInfo.isLastPage == false)					   
					   		<li ><a href="emps?pn=$pageInfo.pages">末页</a></li>
					  		#end
				
					  </ul>
				</nav>
			</div>
		</div>
		<div class="row"></div>
	</div>
</body>
</html>